FROM moxm/java:1.8-full as builder
WORKDIR /build
ARG JAR_FILE=tp-blog-boot/target/tp-blog-boot-1.1.jar
COPY ${JAR_FILE} app.jar
RUN java -Djarmode=layertools -jar app.jar extract && rm app.jar

FROM moxm/java:1.8-full
ENV TZ=Asia/Shanghai
ENV JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
WORKDIR tp

COPY --from=builder /build/dependencies/ ./
RUN true
COPY --from=builder /build/snapshot-dependencies/ ./
RUN true
COPY --from=builder /build/spring-boot-loader/ ./
RUN true
COPY --from=builder /build/application/ ./
RUN true


EXPOSE 3000

CMD sleep 60; java $JAVA_OPTS org.springframework.boot.loader.JarLauncher